import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 言初
 * Date: 2023-02-09
 * Time: 9:49
 */
public class Test {
    public static void main(String[] args) {

    }



    public static void main2(String[] args){
        //哈希思想
        //在一个数组中找到重复的数字和重复次数
        HashMap<Integer,Integer> map=new HashMap<>();
        int[] array={1,3,5,6,7,5,4,3,5,3,2,5};
        for (int x: array) {
            if(!map.containsKey(x)){
                map.put(x,1);
            }else{
                int val=map.get(x);
                
                map.put(x,val+1);
            }
        }

        for (Map.Entry<Integer,Integer> entry:map.entrySet()) {
            if(entry.getValue()>1){
                System.out.println("key :"+entry.getKey()+ "    val: "+entry.getValue());
            }
        }
        System.out.println(map);
    }







    public static void main1(String[] args) {
        BinarySearchTree binarySearchTree=new BinarySearchTree();
        binarySearchTree.insert(6);
        binarySearchTree.insert(5);
        binarySearchTree.insert(8);
        binarySearchTree.insert(7);
        binarySearchTree.insert(35);
        binarySearchTree.inorder(binarySearchTree.root);
        System.out.println();
        System.out.println("=========");
        BinarySearchTree.TreeNode ret=binarySearchTree.find(5);
        System.out.println(ret.val);
        System.out.println("============");
        binarySearchTree.remove(8);
        binarySearchTree.inorder(binarySearchTree.root);
        System.out.println();

    }
}
